package com.alfayun.fiscalriskanalysis.report;

import java.time.LocalDate;
import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.web.bind.annotation.RequestParam;

public interface ReportRepository extends JpaRepository<Report, Integer> {

    public List<Report> findByReportGroupEnterpriseId(Integer enterpriseId);

    public List<Report> findByReportGroupId(Integer groupId);

    @Query(value = "select rg from ReportGroup rg where rg.enterprise.id=:enterpriseId and rg.period=:period and rg.startDate = :startDate and rg.endDate = :endDate")
    public List<ReportGroup> queryReportGroup(@RequestParam("enterpriseId") Integer enterpriseId, @RequestParam("period") ReportPeriod period, @RequestParam("startDate") LocalDate startDate,
            @RequestParam("endDate") LocalDate endDate);
}
